<?php


namespace app\controller\v1;


use app\model\Area;
use think\Request;

class Address
{


    public function __construct(\app\model\Address $address)
    {
        $this->model = $address;
    }


    /**
     * 获取地址
     * @param Request $request
     * @param Area $area
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getArea(Request $request, Area $area)
    {
        return $area->getArea($request->data);
    }

    /**
     * 我的收货地址
     * @param Request $request
     * @return mixed
     * @throws \think\db\exception\DbException
     */
    public function addressList(Request $request)
    {
        return $this->model->list($request->data);
    }


    /**
     * 收货地址操作
     * @param Request $request
     * @return mixed
     */
    public function addressModify(Request $request)
    {
        return $this->model->modify($request->data, $request->user);
    }

}